home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / emacs-18.59src.lha / emacs-18.59 / amiga / contrib / lindgren / xsh11.lha / xshell.el < prev    next >
Encoding:
Text File  |  1993-06-10  |  1.2 KB  |  56 lines

  1. ;;;
  2. ;;;  FILE
  3. ;;;    xshell.el
  4. ;;;
  5. ;;;  DESCRIPTION
  6. ;;;    Filter for removing those pesky ctrl-O:s my shell (WShell)
  7. ;;;    outputs.
  8. ;;;
  9. ;;;    Place the following line in your s:.emacs file:
  10. ;;;
  11. ;;;    (autoload 'xshell "xshell.el" nil t)
  12. ;;;
  13. ;;;  AUTHOR
  14. ;;;     Anders Lindgren, d91ali@csd.uu.se
  15. ;;;
  16. ;;;  STATUS
  17. ;;;    This file is in the public domain.
  18. ;;;
  19.  
  20. (provide 'xshell)
  21.  
  22. (defvar explicit-shell-file-name "xsh")
  23. (defvar explicit-xsh-args '())
  24.  
  25. (defun xshell ()
  26.   (interactive)
  27.   (shell)
  28.   (set-process-filter (get-process "shell") 'strip-ctrl-o-filter))
  29.  
  30.  
  31. (defun strip-ctrl-o-filter (proc string)
  32.   (let ((old-buffer (current-buffer)))
  33.     (unwind-protect
  34.     (let (moving)
  35.       (set-buffer (process-buffer proc))
  36.       (setq moving (= (point) (process-mark proc)))
  37.       (save-excursion
  38.         (goto-char (process-mark proc))
  39.         (insert (strip-ctrl-o string 0))
  40.         (set-marker (process-mark proc) (point)))
  41.       (if moving (goto-char (process-mark proc))))
  42.       (set-buffer old-buffer))))
  43.  
  44. (defun strip-ctrl-o (string start)
  45.   (let ((idx (string-match "\C-O" string start)))
  46.     (cond ((eq idx nil) (substring string start))
  47.       (t (concat (substring string start idx) 
  48.              (strip-ctrl-o string (1+ idx)))))))
  49.     
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.